package sk.klimo.prototyp.server;

import java.util.List;

import sk.klimo.prototyp.client.model.Invoice;

public class InvoiceDAOImpl implements InvoiceDAO {

	private List<Invoice> invoicesList;

	public void setInvoicesList(List<Invoice> invoicesList) {
		this.invoicesList = invoicesList;
	}

	public Invoice getInvoice(String cislo) {
		if (cislo == null) {
			throw new IllegalArgumentException("argument must not be null!");
		}
		Invoice retVal = null;
		for (Invoice i : this.invoicesList) {
			if (cislo.equals(i.getCislo())) {
				retVal = i;
			}
		}
		return retVal;
	}

	public List<Invoice> getInvoices() {
		return this.invoicesList;
	}
}
